<template>
	<view class="index bg-white">
	</view>
</template>

<script>
	import api from "@/api/api";
	export default {
		data() {
			return {
				openId: null
			};
		},
		components: {
		},
		props: {
		},
		computed: {
		},
		onReady() {
		},
		onLoad() {
		},
		mounted() {
		},
		async onShow() {
			let tryCount = 0;
			let openId = null;
			for(let tryTime = 0; tryTime < 600; tryTime++) {
				openId = uni.getStorageSync("openId")
				this.openId = openId;
				console.log("openId", this.openId)
				if (openId) {
					let res = await this.depot.get(api.aiCard("aiVideo/findVideoCount"));
					let aiVideoCount = res && res.data && res.data.data ? res.data.data : 0;
					if (aiVideoCount) {
						uni.reLaunch({
							url: "/pages/index/menus"
						})
					} else {
						uni.reLaunch({
							url:"/pages/aiPerson/createAiPersonTips"
						})
					}
					break;
				}
				await new Promise(resolve => {setTimeout(() => {resolve()}, 1000)})
			}
		}
	};
</script>

<style lang="less" scoped>
	.index {
		height: 100vh;
	}
</style>
